<?
//*************************************************************
// System Notifier v1
// Created by White_Devil
// website :: http://devil-nuke-mods.be/
// e-mail  :: arleighesq@gmail.com
// Created :: 8-14-06
//*************************************************************
// Do not modify without permission unless you need to fix it
// for your distabution of nuke!!!
// You May make Language files Only. Please send me a copy
// Of the language you make Thanks..
//*************************************************************

include_once("mainfile.php");

global $admin_file, $prefix;
if (is_admin($admin)) {
} else {
echo "Acess Denied!!!";
die;
}


$module_name = "System_Notifier";
get_lang($module_name);



if ( $save_it != "" ) {


include("header.php");
global $admin_file, $user, $cookie, $prefix, $db, $user_prefix, $row, $admin;
if (is_admin($admin)) {
} else {
echo "Acess Denied!!!";
die;
}
opentable();
echo "<center><h3>"._MAINTOP."</h3></center>";
echo "<center><a href=\"".$admin_file.".php\">Main Admin Area</a>";

$latestversion = "http://devil-modz.us/versions/snversion.txt";
if(@file($latestversion)){
SNversioncheck();
}

$latestversion1 = "http://devil-modz.us/versions/securityalert.txt";
if(@file($latestversion1)){
DMSecurityNotice();
}

echo "</center>";
closetable();

$guest_text1 = wdcleantextnote($guest_text);
$member_text1 = wdcleantextnote($member_text);

$db->sql_query("update ".$user_prefix."_sysnote_config set wd_show_guest='$guest_box', wd_show_member='$member_box', wd_member_time='$show_time', wd_member_text='$member_text1', wd_guest_text='$guest_text1', wd_guest_amount='$guest_show_time', wd_bg_image='$bg_location' where wd_config='noteconfig'");
$db->sql_query("update ".$user_prefix."_sysnote_users set wd_state='0' where wd_state!='0'");
$db->sql_query("update ".$user_prefix."_sysnote_users set wd_guest_number='0' where wd_guest_number!='0'");
$db->sql_query("update ".$user_prefix."_sysnote_config set wdheight='$box_height', bgcolor='$bg_color', wdwidth='$box_width' where wd_config='noteconfig'");

opentable();
echo "<b><center>"._INFOSAVED."</b></center>";
closetable();

opentable();
echo "<center><a href='modules.php?name=$module_name&file=noteadmin&clean=yes'><u>"._CLEANOUTTABLE."</u></a></center>";
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_sysnote_config WHERE wd_config='noteconfig'"));
$showguest = $row['wd_show_guest'];
$showmember = $row['wd_show_member'];
$showtime = $row['wd_member_time'];
$membertext = $row['wd_member_text'];
$guesttext = $row['wd_guest_text'];
$dafontcolor = $row['wd_font_color'];
$dabgimage = $row['wd_bg_image'];
$daguestamount = $row['wd_guest_amount'];
$boxheight = $row['wdheight'];
$boxwidth = $row['wdwidth'];
$backdropcolor = $row['bgcolor'];

echo "<form method=\"POST\" action=\"modules.php?name=$module_name&file=noteadmin\">";
echo "<center>";
echo ""._GUESTBOXOPTION." :: ";


if ( $showguest == "0" ) {
echo "Yes<input type=\"radio\" value=\"1\" name=\"guest_box\">";
echo "No<input type=\"radio\" name=\"guest_box\" checked value=\"0\"><br>";
} else {
echo "Yes<input type=\"radio\" value=\"1\" checked name=\"guest_box\">";
echo "No<input type=\"radio\" name=\"guest_box\" value=\"0\"><br>";
}

echo ""._SHOWTIMESTOGUESTTEXT."<br>";
echo "<input type=\"text\" name=\"guest_show_time\" size=\"4\" value=\"$daguestamount\"> <i>"._DAINFOTEXT."</i>";
echo "<br>";

echo ""._MEMBERBOXOPTION." :: ";
if ( $showmember == "0" ) {
echo "Yes<input type=\"radio\" name=\"member_box\" value=\"1\">";
echo "No<input type=\"radio\" checked name=\"member_box\" value=\"0\"><br>";
} else {
echo "Yes<input type=\"radio\" checked name=\"member_box\" value=\"1\">";
echo "No<input type=\"radio\" name=\"member_box\" value=\"0\"><br>";
}

echo ""._TIMESHOWOPTION."<br>";
echo "<input type=\"text\" name=\"show_time\" size=\"4\" value=\"$showtime\"><br><br>";// <i>"._DAINFOTEXT."</i><br><br>";

echo ""._PATHTOBACKGROUND."<br>";
echo "<input type=\"text\" name=\"bg_location\" size=\"40\" value=\"$dabgimage\"> <br><i>"._DAINFOBG."</i><br><br>";

echo ""._BACKDROPCOLOR."<br>";
echo "<input type=\"text\" name=\"bg_color\" size=\"6\" value=\"$backdropcolor\"> <br><br>";

echo ""._SNHEIGHTTEXT."<br>";
echo "<input type=\"text\" name=\"box_height\" size=\"6\" value=\"$boxheight\"> <br><br>";

echo ""._SNWIDTHTEXT."<br>";
echo "<input type=\"text\" name=\"box_width\" size=\"6\" value=\"$boxwidth\"><br><br>";


echo "<hr><br>"._MEMBERAREA."<br>";
echo "<textarea rows=\"20\" name=\"member_text\" cols=\"50\">$membertext</textarea><br>";
echo ""._GUESTAREA."<br>";
echo "<textarea rows=\"20\" name=\"guest_text\" cols=\"50\">$guesttext</textarea><br><br>";
echo "<input type=\"submit\" value=\""._SAVEBUTTON."\" name=\"save_it\">";
echo "</form>";
echo "<br><br>"._HELP1."";
closetable();


include("footer.php");




die;


}




include("header.php");
global $admin_file, $prefix, $admin;
if (is_admin($admin)) {
} else {
echo "Acess Denied!!!";
die;
}
opentable();
echo "<center><h3>"._MAINTOP."</h3></center>";
echo "<center><a href=\"".$admin_file.".php\">Main Admin Area</a>";
$latestversion = "http://devil-modz.us/versions/snversion.txt";
if(@file($latestversion)){
SNversioncheck();
}
$latestversion1 = "http://devil-modz.us/versions/securityalert.txt";
if(@file($latestversion1)){
DMSecurityNotice();
}
echo "</center>";
closetable();

if ($clean == "yes") {
$db->sql_query("TRUNCATE TABLE `".$user_prefix."_sysnote_users`");


opentable();
echo "<br><centeR>"._USERTABLECLEANED."</center>";
closetable();

}



opentable();
echo "<center><a href='modules.php?name=$module_name&file=noteadmin&clean=yes'><u>"._CLEANOUTTABLE."</u></a></center>";
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_sysnote_config WHERE wd_config='noteconfig'"));
$showguest = $row['wd_show_guest'];
$showmember = $row['wd_show_member'];
$showtime = $row['wd_member_time'];
$membertext = $row['wd_member_text'];
$guesttext = $row['wd_guest_text'];
$dabgimage = $row['wd_bg_image'];
$daguestamount = $row['wd_guest_amount'];

$boxheight = $row['wdheight'];
$boxwidth = $row['wdwidth'];
$backdropcolor = $row['bgcolor'];


echo "<form method=\"POST\" action=\"modules.php?name=$module_name&file=noteadmin\">";
echo "<center>";
echo ""._GUESTBOXOPTION." :: ";


if ( $showguest == "0" ) {
echo "Yes<input type=\"radio\" value=\"1\" name=\"guest_box\">";
echo "No<input type=\"radio\" name=\"guest_box\" checked value=\"0\"><br>";
} else {
echo "Yes<input type=\"radio\" value=\"1\" checked name=\"guest_box\">";
echo "No<input type=\"radio\" name=\"guest_box\" value=\"0\"><br>";
}


echo ""._SHOWTIMESTOGUESTTEXT."<br>";
echo "<input type=\"text\" name=\"guest_show_time\" size=\"4\" value=\"$daguestamount\"> <i>"._DAINFOTEXT."</i>";
echo "<br>";

echo ""._MEMBERBOXOPTION." :: ";
if ( $showmember == "0" ) {
echo "Yes<input type=\"radio\" name=\"member_box\" value=\"1\">";
echo "No<input type=\"radio\" checked name=\"member_box\" value=\"0\"><br>";
} else {
echo "Yes<input type=\"radio\" checked name=\"member_box\" value=\"1\">";
echo "No<input type=\"radio\" name=\"member_box\" value=\"0\"><br>";
}
echo ""._TIMESHOWOPTION."<br>";
echo "<input type=\"text\" name=\"show_time\" size=\"4\" value=\"$showtime\"><br><Br>"; //<i>"._DAINFOTEXT."</i><br><br>";

echo ""._PATHTOBACKGROUND."<br>";
echo "<input type=\"text\" name=\"bg_location\" size=\"40\" value=\"$dabgimage\"> <br><i>"._DAINFOBG."</i><br><br>";

echo ""._BACKDROPCOLOR."<br>";
echo "<input type=\"text\" name=\"bg_color\" size=\"6\" value=\"$backdropcolor\"> <br><br>";

echo ""._SNHEIGHTTEXT."<br>";
echo "<input type=\"text\" name=\"box_height\" size=\"6\" value=\"$boxheight\"> <br><br>";

echo ""._SNWIDTHTEXT."<br>";
echo "<input type=\"text\" name=\"box_width\" size=\"6\" value=\"$boxwidth\"><br><br>";



echo "<hr><br>"._MEMBERAREA."<br>";
echo "<textarea rows=\"20\" name=\"member_text\" cols=\"50\">$membertext</textarea><br>";
echo ""._GUESTAREA."<br>";
echo "<textarea rows=\"20\" name=\"guest_text\" cols=\"50\">$guesttext</textarea><br><br>";
echo "<input type=\"submit\" value=\""._SAVEBUTTON."\" name=\"save_it\">";
echo "</form>";
echo "<br><br>"._HELP1."";
closetable();


include("footer.php");
















function wdcleantextnote($information) {
$information = str_replace("\"", "&quot;", $information);
$information = str_replace("'", "&#039;", $information);
return $information;
}


function wdcleantextnoterestore($information) {
$information = str_replace("&quot;", "\"", $information);
$information = str_replace("&#039;", "'", $information);
return $information;
}




function SNversioncheck() {

$latestversion = "http://devil-modz.us/versions/snversion.txt";
$installedversion = "3.0";
$upgradeurl = "http://devil-modz.us";
$version = fopen($latestversion, 'r');
$versiondata = fgets($version);
fclose($version);
if($versiondata != $installedversion){
echo "<strong><br><hr>Version Checking System.</strong>";
echo "<br><b>$installedversion</b> is not the the latest version.<br />";
echo "<b>Find Out More</b>&nbsp;<a href='$upgradeurl' target='blank'>$upgradeurl</a>";
}else{
//echo "<br><b>$installedversion</b> is the latest version";
}
echo "";
}


function DMSecurityNotice() {
global $admin_file, $user, $cookie, $prefix, $db, $user_prefix, $row, $admin;
$latestversion1 = "http://devil-modz.us/versions/securityalert.txt";
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_sysnote_config WHERE wd_config='noteconfig'"));
$securitycode = $row['securityalert'];
$upgradeurl = "http://devil-modz.us";
$version = fopen($latestversion1, 'r');
$versiondata = fgets($version);
fclose($version);

if ($securitycode <= $versiondata) {
echo "<hr><br><b><center>Security / Bug Alert<br>
<a href='$latestversion1' target='blank'>Click Here to Read...</a><br>
You will only See this Notice ONCE per Script.</center></b><br>";
$newnumber = $versiondata + 1;
$db->sql_query("update ".$user_prefix."_sysnote_config set securityalert='$newnumber' where wd_config='noteconfig'");


}else{
}
echo "";
}







?>